#include <QMessageBox>
#include <QSharedMemory>

#include "music.h"

#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    // 创建共享内存
    QSharedMemory shareMemory("Music");

    // 如果共享内存已经被占⽤，说明已经有实例在运⾏
    if(shareMemory.attach())
    {
        QMessageBox::information(nullptr,"Music","Music已经在运⾏...");
        return 0;
    }

    shareMemory.create(1);
    Music w;
    w.show();
    return a.exec();
}
